package top.sxlai.util.hbase;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import java.io.IOException;
/**
 * @author : sxl
 * @date : 2024/4/4 9:29
 * @Version: 1.0
 */
public class HbaseConnection {
    //设置静态属性hbase连接
    public static Connection connection = null;
    static {
        //创建hbase的连接
        try {
            connection = ConnectionFactory.createConnection();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
    /**
     * 关闭连接
     * @throws IOException
     */
    public static void closConnection() throws IOException {
        if(connection!=null){
            connection.close();
        }
    }
}
